import fs from 'fs-extra';
import iconv from 'iconv-lite';

export async function readGB2312(file: string): Promise<string> {
    let content = await fs.readFile(file);
    return iconv.decode(content, 'gbk');
}

export async function writeGB2312(file: string, content: string): Promise<void> {
    const c = iconv.encode(content, 'gbk');
    await fs.writeFile(file, c);
}
